package com.jf.identity.controller;

import com.jf.identity.entity.DeviceRouteFeedBack;
import com.jf.identity.entity.ResponseBean;
import com.jf.identity.service.DeviceRouteService;
import com.jf.identity.util.Params;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("vis")
@RestController
public class DeviceRouteController {
    @Resource
    private DeviceRouteService deviceRouteService;

    @RequestMapping("set-identity-devicecheck-info")
    public ResponseBean setDeviceCheck(@Validated @RequestBody DeviceRouteFeedBack deviceRouteFeedBack,
                                       BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        Params.isAnyBlank(deviceRouteFeedBack, deviceRouteFeedBack.getDevices());
        return new ResponseBean(deviceRouteService.insertDeviceRoute(deviceRouteFeedBack.getDevices()));
    }
}
